<template>
	<view class="content poRel">
		<scroll-view style="height: calc(100vh);" class="wid100" scroll-y="true" @scrolltolower="lower">
			<wsj v-if="list.length == 0" zs='0'></wsj>
			<view style="height: 1rpx;"></view>
			<block v-for="(item,index) in list" :key="index">
				<view class="borRad20 wid90 mar" style="background: #F5F5F5;">
					<view class="hei20"></view>
					<view class="wid90 mar">
						<view class="dis disAl">
							<view class="hei80" style="width: 20%;">
								<image v-if="item.user.avatar==''" src="../../static/tu3.png" class="borRad50 hei100" style="width: 80rpx;"></image>
								<image v-else :src="url+item.user.avatar" class="borRad50 hei100" style="width: 80rpx;"></image>
							</view>
							<view style="width: 80%;">
								<view class="wid100 dis disAl disJuB">
									<view class="fowe600 foSi28 liH40 overflowHidden" style="width: 60%;">{{item.user.nickname}}</view>
									<view class="foSi20" style="color: #878787;">{{item.createtime}}</view>
								</view>
								<view class="mar-top10 dis disAl">
									<block v-for="(item1, index1) in 5" :key="index1">
										<uni-icons v-if="item.star >= index1+1" type="star-filled" size="30rpx" color="#D81E06"></uni-icons>
										<uni-icons v-if="item.star < index1+1" type="star" size="30rpx" color="#000000"></uni-icons>
									</block>
								</view>
							</view>
						</view>
						<view class="dis mar-top20">
							<view  style="width: 20%;"></view>
							<view class="liH40 webkitLineClamp foSi25" style="width: 80%;height: 80rpx;">{{item.content}}</view>
						</view>
					</view>
					<view style="height: 20rpx;"></view>
				</view>
			</block>
			<view style="height: 150rpx;"></view>
		</scroll-view>
		<view class="poFix wid100 dis disAl disJuC bacFFF" style="height: 124rpx;border-top: 1rpx solid #878787;bottom: 0;">
			<view class="wid90 borRad40 dis disAl disJuC coFFF foSi35" @click="fanhui()"
				style="height: 85rpx;" :style="'background-color: '+theme.main_color+';'">返回上页</view>
		</view>
	</view>
</template>

<script>
	import wsj from '../common/w_sj.vue'
	export default {
		components: {
			wsj
		},
		data() {
			return {
				url: this.global.url,
				timer: null,
				last_page: 0,
				page: 1,
				id: '',
				list: [],
				theme: null
			}
		},
		onLoad(option) {
			this.id = option.tech_id
			this.theme = uni.getStorageSync('theme')
			this.getList()
		},
		methods: {
			getList(){
				var that = this
				uni.request({
					url: that.global.url + 'api/qianyu_smfw/technician/comment_list',
					method: "POST",
					header: {
						'site-id': that.global.site_id//自定义请求头信息
					},
					data: {
						tech_id: that.id,
						page: that.page
					},
					success(res) {
						let result = res.data
						if (result.code == 1) {
							that.last_page = result.data.last_page
							if(that.page == 1){
								that.list = result.data.data
							}else{
								that.list = that.list.concat(result.data.data)
							}
						}else{
							uni.showToast({
								title: result.msg,
								//将值设置为 success 或者直接不用写icon这个参数
								icon: 'error',
								//显示持续时间为 2秒
								duration: 2000
							}) 
						}
					}
				})
			},
			lower(e) {
				if(this.last_page > this.page){
					this.page++
					this.getList()
				}
			},
			fanhui(){
				uni.navigateBack(1)
			},
			tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content{
		background-color: #F3F1F1;
	}
	.tim1{
		padding: 10rpx;
		border-radius: 5rpx;
	}
	.butt2{
		width: 125rpx;
		height: 50rpx;
		border-radius: 10rpx;
	}
	.richImg {
	    width: 100% !important;
	    height: auto !important;
	}
</style>
